﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Dtyo.Master" AutoEventWireup="true" CodeBehind="EmpList.aspx.cs" Inherits="Dtyo_WebRole.Emp.EmpList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h3>Employee List</h3>
  
    <form id="addEmployeeForm" action="">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    </div>      
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <ul>
                <asp:DataList ID="EmployeeList" runat="server" DataSourceID="EmployeeListDataSource">
                    <ItemTemplate>
                         <li><a href="EmpDetails.aspx?rowkey<%# "=" + Eval("Rowkey") %>"> <%# Eval("LastName") %>, <%# Eval("FirstName") %></a></li>
                    </ItemTemplate>
                </asp:DataList>
            <asp:Timer ID="EmpTimer" runat="server" Interval="15000" OnTick="EmpTimer_Tick">
            </asp:Timer>
            <asp:DetailsView DataSourceID="DepartmentEntryDataSource" runat="server" >
                
            </asp:DetailsView>
           
            </ul>
        </ContentTemplate>
    </asp:UpdatePanel>
    <h3>Add Employee</h3>
    <table>   
        <tr>
            <td>FirstName:</td>
            <td><asp:TextBox ID="txtFirstName" runat="server" /></td>
        </tr>
        <tr>
            <td>LastName: </td>
            <td><asp:TextBox ID="txtLastName" runat="server"/></td>
        </tr>
        <tr>
            <td>Department: </td>
            <td>
                <asp:DropDownList id="ddDeps" DataSourceID="DepartmentListDataSource" 
				    DataTextField="Name" 
				    DataValueField="RowKey" 
				    AppendDataBoundItems="True"
				    Runat="server">
			        <asp:ListItem Text="-- Select --"  /> 	
			    </asp:DropDownList>     
            </td>
        </tr>
        <tr>   
            <td></td>
            <td><asp:Button ID="AddEmployeeButton" runat="server" OnClick="SaveEmployeeButton_Click" Text="Save" /><input type="reset" value="Cancel"/></td>
        </tr>
    </table>
    
    <asp:ObjectDataSource ID="DepartmentEntryDataSource" runat="server" DataObjectTypeName="Dtyo_WebRole.Department"
        InsertMethod="SaveDepartment" SelectMethod="SelectDepartment" TypeName="Dtyo_WebRole.DtyoDataSource">
        <SelectParameters>
            <asp:Parameter Name="RowKey" />
        </SelectParameters>
    </asp:ObjectDataSource>
    
    </form>
    
    <a href="../Index.aspx">Pääsivu</a>
</asp:Content>
